import time

from kafka import KafkaConsumer

if __name__ == "__main__":
    consumer = KafkaConsumer(
        "SYSTEM_MASTER_IN",
        bootstrap_servers=["192.168.120.221:9093"],
        max_poll_records=10,
    )

    while True:
        messages = consumer.poll(timeout_ms=1000)
        if not messages:
            continue
        for topic_partition, records in messages.items():
            for record in records:
                print(record.value.decode("utf-8"))
        time.sleep(2)
